package com.waijiaojun.tpo.utils;

import com.waijiaojun.tpo.web.ExerciseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Created by Peter on 2018/1/26.
 */
@Component
public class Constants {
    private static Logger logger = LoggerFactory.getLogger(Constants.class);
    public static String goodsDetail = "托福线上练习";
    public static String goodsName = "TPO";
    public static Long goodsPrice;
    @Value("${goods.price}")
    public void setGoodsPrice(Long value){
        logger.info("goods.price="+value);
        goodsPrice = value;
    }

    public static Long goodsActivityPrice;
    @Value("${goods.price.activity}")
    public void setGoodsActivityPrice(Long value){
        logger.info("goods.price.activity="+value);
        goodsActivityPrice = value;
    }


    /* ******************** 微信ID *****************************************************************************  */
    public static Long publicId;
    @Value("${WeiXin.PublicId}")
    public void setPublicId(Long value){
        logger.info("WeiXin.PublicId="+value);
        publicId = value;
    }

    /* ******************** 253云通信平台 短信API配置 ***********************************************************  */
    //国内短信
    public static String sms_account = "N2551506";
    public static String  sms_key= "UjGnvkEm0Jfaae";
    public static String sms_url = "http://sms.253.com/msg/send";

    // 国际短信
    public static String sms_inter_account = "I3223831";
    public static String sms_inter_key = "jWdEByf6Vh2ec2";
    public static String sms_inter_url = "http://intapi.253.com/send/json";

    @Value("${sms.account}")
    public void setSmsAccount(String value){
        logger.info("sms.account="+value);
        sms_account = value;
    }
    @Value("${sms.key}")
    public void setSmsKey(String value){
        logger.info("sms.key="+value);
        sms_key = value;
    }
    @Value("${sms.url}")
    public void setSmsUrl(String value){
        logger.info("sms.url="+value);
        sms_url = value;
    }
    @Value("${sms.inter.account}")
    public void setSmsInterAccount(String value){
        logger.info("sms.inter.account="+value);
        sms_inter_account = value;
    }
    @Value("${sms.inter.key}")
    public void setSmsInterKey(String value){
        logger.info("sms.inter.key="+value);
        sms_inter_key = value;
    }
    @Value("${sms.inter.url}")
    public void setSmsInterUrl(String value){
        logger.info("sms.inter.url="+value);
        sms_inter_url = value;
    }

    // 阿里云OSS
    public static String ossEndpoint = "http://oss-cn-hangzhou.aliyuncs.com";
    @Value("${aliyun.oss.endpoint}")
    public void setOssEndpoint(String value){
        logger.info("aliyun.oss.endpoint="+value);
        ossEndpoint = value;
    }

    public static String ossAccessKeyId = "dzhm6kIZDL8VpgPP";
    @Value("${aliyun.oss.accessKeyId}")
    public void setOssAccessKeyId(String value){
        logger.info("aliyun.oss.accessKeyId="+value);
        ossAccessKeyId = value;
    }

    public static String ossAccessKeySecret = "4qSofG2TiEABy1Gcs0IhgHXpdLKust";
    @Value("${aliyun.oss.accessKeySecret}")
    public void setOssAccessKeySecret(String value){
        logger.info("aliyun.oss.accessKeySecret="+value);
        ossAccessKeySecret = value;
    }

    public static String ossBucketName = "waijiaojun";
    @Value("${aliyun.oss.bucketName}")
    public void setOssBucketName(String value){
        logger.info("aliyun.oss.bucketName="+value);
        ossBucketName = value;
    }

    public static String ossRootDir;
    @Value("${aliyun.oss.rootDir}")
    public void setOssRootDir(String value){
        logger.info("aliyun.oss.rootDir="+value);
        ossRootDir = value;
    }

    public static String ossDomain;
    @Value("${aliyun.oss.domain}")
    public void setOssDomain(String value){
        logger.info("aliyun.oss.domain="+value);
        ossDomain = value;
    }


    /* ******************** 测试用户配置 ***********************************************************  */
    public static Boolean testUserModel;
    public static String testUserOpenid;
    public static String testUserNickname;

    @Value("${weixin.oauth.test.model}")
    public void setTestUserModel(Boolean value){
        logger.info("weixin.oauth.test.model="+value);
        testUserModel = value;
    }

    @Value("${weixin.oauth.test.user.openid}")
    public void setTestUserOpenid(String value) {
        logger.info("weixin.oauth.test.user.openid="+value);
        testUserOpenid = value;
    }

    @Value("${weixin.oauth.test.user.nickname}")
    public void setTestUserNickname(String value) {
        logger.info("weixin.oauth.test.user.nickname="+value);
        testUserNickname = value;
    }




    //log 记录方法入参的前缀
    public static final String prefix_in = "\nparameters in -->> ";
    //log 记录方法出参的前缀
    public static final String prefix_out = "\nparameters out -->>";

    // 百度API配置 -----------------------------------------------------------------------------------------------------
    public static String baiduApiAppid;
    @Value("${baidu.api.appid}")
    public void setBaiduApiAppid(String value){
        logger.info("baidu.api.appid="+value);
        baiduApiAppid = value;
    }

    public static String baiduApiKey;
    @Value("${baidu.api.key}")
    public void setBaiduApiKey(String value){
        logger.info("baidu.api.key="+value);
        baiduApiKey = value;
    }

    public static String baiduApiSecretKey;
    @Value("${baidu.api.secret.key}")
    public void setBaiduApiSecretKey(String value){
        logger.info("baidu.api.secret.key="+value);
        baiduApiSecretKey = value;
    }

}
